package com.ssn.pattern;

import java.lang.reflect.Proxy;

public class FooTest
{
	public static void main(String[] args){
		FooInvocation handler = new FooInvocation();
		Foo f = null;
		handler.setObj(new FooImpl());
		f = (Foo) Proxy.newProxyInstance(
					Foo.class.getClassLoader(),
					new Class[]{Foo.class},
					handler);
		f.doAction();
		System.out.println("____________________________");
		handler.setObj(new FooImpl2());
		f = (Foo) Proxy.newProxyInstance(
					Foo.class.getClassLoader(),
					new Class[]{Foo.class},
					handler);
		f.doAction();
	}
}
